﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for cls_tb_HeaderReport_Bienlai
/// </summary>
public class cls_tb_HeaderReport_Bienlai
{
	public cls_tb_HeaderReport_Bienlai()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    #region Select
    public DataTable Select_byMaCN(string F_MACN)
    {
        DataTable dt = new DataTable();
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        SqlParameter[] para = new SqlParameter[1];

        para[0] = new SqlParameter("@F_MACN", F_MACN);

        try
        {
            dt = connect.GetSelectCommand("tb_HeaderReport_Bienlai_Select_byMaCN", para);
        }
        catch { }
        return dt;
    }
    #endregion
    #region Insert
    public string Insert(string F_MACN, string CenterName_display, string Address_display, string Phone_display, string Fax_display, string MaCN_on_BL)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        SqlParameter[] para = new SqlParameter[6];
        para[0] = new SqlParameter("@F_MACN", F_MACN);
        para[1] = new SqlParameter("@CenterName_display", CenterName_display);
        para[2] = new SqlParameter("@Address_display", Address_display);
        para[3] = new SqlParameter("@Phone_display", Phone_display);
        para[4] = new SqlParameter("@Fax_display", Fax_display);
        para[5] = new SqlParameter("@MaCN_on_BL", MaCN_on_BL);
        

        try
        {
            connect.ExecuteQuery("tb_HeaderReport_Bienlai_Insert", para);
            return "OK";
        }
        catch
        {
            return "ERR";
        }
    }
    #endregion
    #region Update
    public string Update(string F_MACN, string CenterName_display, string Address_display, string Phone_display, string Fax_display, string MaCN_on_BL)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        SqlParameter[] para = new SqlParameter[6];
        para[0] = new SqlParameter("@F_MACN", F_MACN);
        para[1] = new SqlParameter("@CenterName_display", CenterName_display);
        para[2] = new SqlParameter("@Address_display", Address_display);
        para[3] = new SqlParameter("@Phone_display", Phone_display);
        para[4] = new SqlParameter("@Fax_display", Fax_display);
        para[5] = new SqlParameter("@MaCN_on_BL", MaCN_on_BL);

        try
        {
            connect.ExecuteQuery("tb_HeaderReport_Bienlai_Update", para);
            return "OK";
        }
        catch
        {
            return "ERR";
        }
    }
    #endregion
    #region Delete
    public string Delete(string F_MACN)
    {
        DatabaseConnect connect = new DatabaseConnect();
        // Tham so
        SqlParameter[] para = new SqlParameter[1];
        para[0] = new SqlParameter("@F_MACN", F_MACN);

        try
        {
            connect.ExecuteQuery("tb_HeaderReport_Bienlai_Delete", para);
            return "OK";
        }
        catch
        {
            return "ERR";
        }
    }
    #endregion
}